# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=impacket-ba
_pkgname=impacket
pkgver=0.12.0
pkgrel=5
pkgdesc='Collection of classes for working with network protocols.'
url='https://github.com/fortra/impacket'
arch=('any')
groups=('blackarch' 'blackarch-exploitation' 'blackarch-networking')
license=('Apache')
depends=('python'
         'python-pyasn1'
         'python-pyasn1-modules'
         'python-pycryptodomex'
         'python-pyopenssl'
         'python-six'
         'python-ldap3'
         'python-ldapdomaindump'
         'python-flask'
         'python-setuptools'
         'python-charset-normalizer'
)
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('48db5e2973cebc87a84118f2d83202f9583f45b4294e7b17c49da32bd6aedcf4e704447dd9d87e03f754c3947a9759a39624e44c5849718daae9e96b04f9aeb0')
provides=('impacket')
conflicts=('impacket')

prepare() {
  cd "$_pkgname-$pkgver"

  # This requirement is too hardcore and never aligned with AL version
  sed -i 's/pyOpenSSL==24.0.0/pyOpenSSL>=24.0.0/' setup.py
}

build() {
  cd "$_pkgname-$pkgver"

  python setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

